package test;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

import core.Player;
import core.field.Refuge;

public class JUnitRefugeField {
	private Player testPlayer;
	private Refuge test200;
	private Refuge test0;
	private Refuge testNeg200;


	@Before
	public void setUp() throws Exception {
		this.testPlayer = new Player("test");
		this.test200= new Refuge("test1", 200);
		this.test0= new Refuge("test2", 0);
		this.testNeg200 = new Refuge("test3", -200);
		
		
	}
	
	
	@Test
	public void testEntities() {
		assertNotNull(this.testPlayer);
		assertNotNull(this.test200);
		assertNotNull(this.test0);
		assertNotNull(this.testNeg200);
		
		assertTrue(new Refuge().getClass().equals(test200.getClass()));
		assertTrue(new Refuge().getClass().equals(test0.getClass()));
		assertTrue(new Refuge().getClass().equals(testNeg200.getClass()));
		assertTrue(new Player().getClass().equals(testPlayer.getClass()));
	}
	
	@Test
	public void testLandOnfField200(){
		int expected = 30000;
		int actual = this.testPlayer.getPoints();
		assertEquals(expected, actual);
		
		// performing the actual test
		this.test200.landOnField(testPlayer);
		
		expected = 30200;
		actual = this.testPlayer.getPoints();
		assertEquals(expected, actual);
		
	}
	
	@Test
	public void testLandOnfField200Twice(){
		int expected = 30000;
		int actual = this.testPlayer.getPoints();
		assertEquals(expected, actual);
		
		// performing the actual test
		this.test200.landOnField(testPlayer);
		this.test200.landOnField(testPlayer);
		
		expected = 30400;
		actual = this.testPlayer.getPoints();
		assertEquals(expected, actual);
		
	}
	
	@Test
	public void testLandOnField0(){
		int expected = 30000;
		int actual = this.testPlayer.getPoints();
		assertEquals(expected, actual);
		
		// performing the actual test
		this.test0.landOnField(testPlayer);
		
		
		expected = 30000;
		actual = this.testPlayer.getPoints();
		assertEquals(expected, actual);
	}
	
	@Test
	public void testLandOnField0Twice(){
		int expected = 30000;
		int actual = this.testPlayer.getPoints();
		assertEquals(expected, actual);
		
		// performing the actual test
		this.test0.landOnField(testPlayer);
		this.test0.landOnField(testPlayer);
		
		expected = 30000;
		actual = this.testPlayer.getPoints();
		assertEquals(expected, actual);
	}
	
	@Test
	public void testLandOnFieldNeg200(){
		int expected = 30000;
		int actual = this.testPlayer.getPoints();
		assertEquals(expected, actual);
		
		// performing the actual test
		this.testNeg200.landOnField(testPlayer);
		
		
		expected = 30200;
		actual = this.testPlayer.getPoints();
		assertEquals(expected, actual);
	}
	
	@Test
	public void testLandOnFieldNeg200Twice(){
		int expected = 30000;
		int actual = this.testPlayer.getPoints();
		assertEquals(expected, actual);
		
		// performing the actual test
		this.testNeg200.landOnField(testPlayer);
		this.testNeg200.landOnField(testPlayer);
		
		expected = 30400;
		actual = this.testPlayer.getPoints();
		assertEquals(expected, actual);
	}
	

}
